package com.hd.crdao.activity;

import android.annotation.SuppressLint;
import android.view.View;
import android.webkit.WebView;

import com.hd.crdao.R;
import com.hd.crdao.base.BaseActivity;
import com.hd.crdao.view.ExpandHeadView;

/**
 *
 *@author Administrator
 *@date 2017/7/4 0004
 */
public class UserAgreementActivity extends BaseActivity {
    ExpandHeadView mExpandHeadView;
    private WebView webView;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_user_agreement;
    }

    @SuppressLint("SetJavaScriptEnabled")
    @Override
    protected void initView() {
        mExpandHeadView = (ExpandHeadView) findViewById(R.id.user_agreement_head);

        webView = (WebView) findViewById(R.id.webview);
        //支持javascript
        webView.getSettings().setJavaScriptEnabled(true);
        //设置可以支持缩放
        webView.getSettings().setSupportZoom(true);
        //扩大比例的缩放
        webView.getSettings().setUseWideViewPort(true);
        //控制webview自适应屏幕
        webView.getSettings().setLoadWithOverviewMode(true);
        webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
    }

    @Override
    protected void initListener() {
        mExpandHeadView.getLeftArrowLL().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }

    @Override
    protected void initData() {
        webView.loadUrl("file:///android_asset/html/buy_agreement_con.html");
    }
}
